package board.spring.mvc.board.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import board.spring.mvc.board.interfaces.ArticleService;
import board.spring.mvc.board.interfaces.ArticleDao;
import board.spring.mvc.board.model.Article;

@Service
public class ArticleServiceImpl implements ArticleService {

	@Autowired ArticleDao articleDao;
	
	public Article selectArticle(int num) {
		return articleDao.selectArticle(num);
	}
	
	public List<Article> selectArticles() {
		return articleDao.selectArticles();
	}
	
	@Transactional
	public void insertArticle(Article article) {
		articleDao.insertArticle(article);
	}
	
	@Transactional
	public void deleteArticle(int num) {
		articleDao.deleteArticle(num);
	}
}
